package com.mapper;

import com.pojo.Brand;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BrandMapper {

    //    查询所有
    @Select("select * from tb_brand")
    List<Brand> selectAll();

    //    添加操作，这里#{}占位符名字要和数据库的一致
    @Insert("insert into tb_brand values(null,#{name},#{company},#{ordered},#{des},#{status})")
    void add(Brand brand);

    //    数据回显，根据id获取对应的商品值
    @Select("select * from tb_brand where id = #{id}")
    Brand selectID(int id);

    //    数据修改
    @Update("update tb_brand set name='${name}',company='${company}',ordered='${ordered}',des='${des}',status='${status}' where id = ${id}")
    void update(Brand brand);

    //    数据删除
    @Delete("delete from tb_brand where id = #{id}")
    void out(int id);
}
